package day05home;
/*
由系统随机出10道加法题，而后由用户来答题，答题后输出"答对了"或"答错了"，答对1题得10分，答错1题不扣分，最后输出总分数。
 */

import java.util.Scanner;

public class Addition {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int score = 0;
        for (int i = 1; i <= 10; i++) {
            int a = (int) (Math.random() * 100);
            int b = (int) (Math.random() * 100);
            int num = a + b;
            System.out.println("(" + i + ")" + a + "+" + b + "=" + "?");
            System.out.println("请回答");
            int resut = scan.nextInt();
            if (resut == num) {
                System.out.println("恭喜你答对了");
                score += 10;

            } else {
                System.out.println("不好意思答错了哦");
            }
        }
        System.out.println("你的得分为：" + score);
    }
}
